//
//  Float+Extensions.swift
//  MYModule
//
//  Created by 尹琼 on 2022/11/21.
//

import UIKit

public extension CGFloat {
    
    var leadingZero:String{
        return String(format: "%.2f", self)
    }
    
    var normalTitle: String {
        if self == 0.0 {
            return "--"
        }
        return normalTitle(format: "%.2f")
    }
    
    func normalTitle(format: String) ->String {
        if self == 0 {
            return "--"
        }
        return String(format: format, self)
    }
    
}

public extension Double {
    
    var leadingZero:String{
        return String(format: "%.2f", self)
    }
    
    var normalTitle: String {
        if self == 0.0 {
            return "--"
        }
        return normalTitle(format: "%.2f")
    }
    
    func normalTitle(format: String) ->String {
        if self == 0 {
            return "--"
        }
        return String(format: format, self)
    }
    
}
